<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		 <input id="inputId" type="text" value="Java JS"/><br/>
		 <input type="button" onclick="clickMe()"  value="点我"/><br/>
		 <button onclick="clickMeJQuery()">点我JQuery</button>
		
		<script src="js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			// 页面加载完之后执行的方法
			window.onload1 = function() {
				// int v;
				var v;//undefined
				console.log(v);
				v = "abc";
				console.log(v);// "abc"
				console.log(typeof(v));//string
				v = 10;
				console.log(v);// 10
				console.log(typeof(v));//number
				v = "10";
				console.log(v);// "10"
				console.log(typeof(v));//string
				var num = 2;
				console.log(num + v); // "210"
				// Integer.parseInt(v);
				console.log(num + parseInt(v)); // 12
			}
			
			function clickMe() {
				// document是内置对象, element:元素、标签
				var input1 = document.getElementById("inputId");
				console.log(input1);
				console.log(input1.id);// inputId
				console.log(input1.value);// Java JS 
				console.log(input1.type);// text
				input1.value = "PHP Java";
				var inputs = document.getElementsByTagName("input");
				console.log(inputs);
				console.log(inputs[0]);
				console.log(inputs[1]);
				
			}
			
			function clickMeJQuery() {
				// <input id="inputId" type="text" value="Java JS"/><br/>
				// attribute:属性
				var id = $("#inputId").attr("id");
				console.log(id);//inputId
				var inputJQuery = $("#inputId");// JQuery封装的input标签对象
				console.log(inputJQuery.attr("type"));// text
				console.log($("#inputId").attr("value"));// Java JS
				// $("#inputId").attr("type", "password");
				$("#inputId").attr("value", "JS SSM");
				// 对value属性或者值还有赋值经常用到，所以单独封装了一个.val()
				console.log($("#inputId").val());
				$("#inputId").val("ABC");
			}
		</script>
	</body>
</html>
